//
//  LTY_MusicProjectTableViewCell.m
//  MooMusic
//
//  Created by 守护神 on 15/10/21.
//  Copyright © 2015年 wjy. All rights reserved.
//

#import "LTY_MusicProjectTableViewCell.h"

@implementation LTY_MusicProjectTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatMusicProjectSubviews];
    }
    return self;
}

// 创建subviews
- (void)creatMusicProjectSubviews
{
    picImageView = [[UIImageView alloc] init];
    //picImageView.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:picImageView];
    
    nameLabel = [[UILabel alloc] init];
    //nameLabel.backgroundColor = [UIColor redColor];
    nameLabel.font = [UIFont systemFontOfSize:20];
    [self.contentView addSubview:nameLabel];
    
    descLabel = [[UILabel alloc] init];
    //descLabel.backgroundColor = [UIColor orangeColor];
    descLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:descLabel];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).with.offset(10);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.mas_equalTo(SCREENWIDTH - 20);
        make.height.mas_equalTo(120);
        
    }];
    
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(picImageView.mas_bottom).with.offset(10);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.mas_equalTo(SCREENWIDTH - 20);
        make.height.mas_equalTo(30);
        
    }];
    
    [descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(nameLabel.mas_bottom).with.offset(5);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.mas_equalTo(SCREENWIDTH - 20);
        make.height.mas_equalTo(20);
        
    }];
    
    
}

- (void)setMdoel:(LTY_MusicProjectModel *)mdoel
{
    _mdoel = mdoel;
    [picImageView sd_setImageWithURL:[NSURL URLWithString:mdoel.picUrl] placeholderImage:[UIImage imageNamed:@"network-disabled.png"]];
    nameLabel.text = mdoel.name;
    descLabel.text = mdoel.desc;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
